package com.ely.coupon.distribute.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ely.coupon.distribute.entity.Coupon;

public interface CouponMapper extends BaseMapper<Coupon> {
    /**
     * @param memberId
     * @param couponActivityId
     * @return
     */
    default Long selectCouponCount(Long memberId, Long couponActivityId) {
        QueryWrapper<Coupon> qw = new QueryWrapper<>();
        qw.lambda().eq(Coupon::getMemberId, memberId).eq(Coupon::getCouponActivityId, couponActivityId).eq(Coupon::getStatus, 1);
        return this.selectCount(qw);
    }
}